package com.wyc.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.wyc.service.ConsumerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author
 */
@CrossOrigin
@RestController
public class ConsumerController {

    @Autowired
    private ConsumerService consumerService;

    @RequestMapping(value = "/consumer", method = RequestMethod.POST)
    public String consumer(HttpServletRequest request, @RequestBody String jsonString){
        JSONObject jsonObject = JSON.parseObject(jsonString);
        String type = jsonObject.getString("type");
        return consumerService.consumer(request, type);
    }
}
